package com.xx.java8.chapter4;

import java.util.function.UnaryOperator;
import java.util.stream.Stream;

public class MainApp3 {
    public static void main(String[] args) {
        Stream.iterate(0, integer -> integer + 2).limit(10).forEach(System.out::println);

        Stream.iterate(new int[]{0, 1}, ints -> new int[]{ints[1], ints[0] + ints[1]})
                .limit(20)
                .forEach(a -> System.out.println("[" + a[0] + "," + a[1] + "]"));

        Stream.iterate(new int[]{0, 1}, ints -> new int[]{ints[1], ints[0] + ints[1]})
                .limit(10)
                .map(a -> a[0])
                .forEach(System.out::println);
    }
}
